package com.augurit.gzcgwsp.jzfqwczz.common.dao;

import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;
import com.augurit.common.base.dao.BaseDao;
import com.augurit.gzcgwsp.jzfqwczz.common.entity.YwYnBusinfoNssy;

@Repository
public class YwYnBusinfoNssyDao extends BaseDao<YwYnBusinfoNssy, Long> {


	public void updateYwYnBusinfoNssy(YwYnBusinfoNssy ywYnBusinfoNssy) {
		getSession().update(ywYnBusinfoNssy);
	}

	public YwYnBusinfoNssy getYwYnBusinfoNssy(Long id) {
		Session session=getSession();
		Criteria criteria=session.createCriteria(YwYnBusinfoNssy.class);
		criteria.add(Restrictions.eq("id",id ));
		List list=criteria.list();
		YwYnBusinfoNssy entity=null;
		if(list!=null && list.size()>0){
			entity=(YwYnBusinfoNssy) list.get(0);
		}
		
		return entity;
	}

	/**
	 * 保存实体
	 * @param entity
	 * @return
	 */
	public Long saveEntity(YwYnBusinfoNssy entity) {
		Session session=getSession();
		return (Long) session.save(entity);
	}

}
